package org.third.common;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module;

import javax.net.ssl.SSLContext;

import java.security.NoSuchAlgorithmException;

class HibernateAwareObjectMapper extends ObjectMapper {

    public HibernateAwareObjectMapper() {
        Hibernate4Module hibernate4Module = new Hibernate4Module();
        hibernate4Module.disable(Hibernate4Module.Feature.USE_TRANSIENT_ANNOTATION);
        registerModule(hibernate4Module); 
    }
}

public class StringUtil {
    static final HibernateAwareObjectMapper mapper = new HibernateAwareObjectMapper();

    static {
        mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
        mapper.configure(SerializationFeature.INDENT_OUTPUT, true);

        mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
        mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
    }

    public static final <T> String toString(T t) throws JsonProcessingException {
        return mapper.writeValueAsString(t);
    }
public static void main(String[] args) throws NoSuchAlgorithmException {
    SSLContext sslContext = SSLContext.getInstance("TLSV1.2");

}
}